package com.zhudeshuai.zhudemolist.util;

import android.app.Activity;
import android.support.design.widget.Snackbar;
import android.widget.Toast;

import com.zhudeshuai.zhudemolist.base.DemoApplication;

/**
 * @author zhudeshuai
 * @since 16/4/12
 */
public class ToastUtil {

    private static Toast sToast;
    private static Snackbar sSnackBar;


    public static void showToast(String msg) {
        if (sToast == null) {
            sToast = Toast.makeText(DemoApplication.getApplication(), msg, Toast.LENGTH_SHORT);
        }
        sToast.setText(msg);
        sToast.show();
    }

    public static void showSnackBar(Activity activity, String msg) {
        sSnackBar = Snackbar.make(activity.getWindow().getDecorView(), msg, Snackbar.LENGTH_SHORT);
        sSnackBar.setText(msg);
        sSnackBar.show();
    }

}
